<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>添加分类</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
      <script type="text/javascript" src="/adminjsps/js/jquery-3.2.1.min.js"></script>
<style type="text/css">
	body {background: rgb(254,238,189);}
</style>
  </head>
  
  <body>
    <h1>添加分类</h1>
    <p style="font-weight: 900; color: red">${msg }</p>
    <div>
    	分类名称：<input type="text" name="cname" class="cate">
    	<input type="submit" value="添加分类" class="btn">
        <span id="span"></span>
    </div>
    <script>
        $(".btn").click(function () {
            var cname = $(".cate").val();
            $.ajax({
                url:"/addcate",
                type:"get",
                data:{
                    cname:cname
                },
                success:function (re) {
                    if (re.code == 1001) {
                        // alert(re.msg)
                        $("#span").html(re.msg)
                    }else if (re.code == 1002) {
                        // alert(re.msg)
                        $("#span").html(re.msg)
                    }else if (re.code == 1000) {
                        // alert(re.msg)
                        $("#span").html(re.msg)
                    }
                }
            })
        })
    </script>
  </body>
</html>
